package com.scl.springtalis.controller;

import com.scl.springtalis.polo.Result;
import com.scl.springtalis.utils.AliOSSUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

@RestController
@Slf4j
public class UploadController {
    @Autowired
    private AliOSSUtils aliOSSUtils;
    @PostMapping("upload")
    public Result upload(MultipartFile image) throws IOException {
        log.info("上传图片");
        String url = aliOSSUtils.upload(image);
        log.info("上传完成");
        return Result.success(url);


    }
}
